	<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand nav-bar-menu" href="<?php echo base_url(); ?>" data-view="home"><?php echo APP_NAME; ?></a>
        </div>
        <div class="navbar-collapse collapse">
    	    <ul class="nav navbar-nav">
            <li class="<?php echo ($view == ''? 'active' : 'home') ?>"><a href="<?php echo base_url(); ?>" class="nav-bar-menu" data-view="home">Home</a></li>
            <?php
              $userIsLogged = 0;

              if (isset($user)) {
                if ($user['IsLoggedIn']) $userIsLogged = 1;
              }
			  
			        if (!$userIsLogged) {
                ?>
                  <li><a href="<?php echo base_url(); ?>index.php/about">About</a></li>
                  <li><a href="<?php echo base_url(); ?>index.php/contact">Contact</a></li>
                <?php
              }
              else {
                if ($user['Role'] == SUPER_USER_ROLE ||
                    $user['Role'] == ADMIN_ROLE) {
                  ?>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown">Training <b class="caret"></b></a>
                      <ul class="dropdown-menu">
                         <li class="<?php echo ($view == 'trainees'? 'active' : 'trainees') ?>"><a href="<?php echo base_url(); ?>#trainees" class="nav-bar-menu" data-view="trainees">Trainees</a></li>
                         <li class="<?php echo ($view == 'trainings'? 'active' : 'trainings') ?>"><a href="<?php echo base_url(); ?>#training" class="nav-bar-menu" data-view="trainings">Training</a></li>
                      </ul>
                    </li>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown">Reference Tables <b class="caret"></b></a>
                      <ul class="dropdown-menu">
                        <li class="dropdown-header">GEOGRAPHICAL</li>
                        <li class="<?php echo ($view == 'region-groups'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>#island-groups" class="nav-bar-menu" data-view="region-groups">Island Groups</a></li>
                        <li class="<?php echo ($view == 'regions'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>#regions" class="nav-bar-menu" data-view="regions">Regions</a></li>
                        <li class="<?php echo ($view == 'locality-groups'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>#sub-regions" class="nav-bar-menu" data-view="locality-groups">Sub Regions</a></li>
                        <li class="<?php echo ($view == 'localities'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>#localities" class="nav-bar-menu" data-view="localities">Localities</a></li>
                        <li class="<?php echo ($view == 'clusters'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>#clusters" class="nav-bar-menu" data-view="clusters">Clusters</a></li>
                        <li class="<?php echo ($view == 'districts'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>#districts" class="nav-bar-menu" data-view="districts">Districts</a></li>
                        <li class="divider"></li>
                        <li class="dropdown-header">SAINT REFERENCES</li>
                        <li class="<?php echo ($view == 'educational-degrees'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>#educational-degrees" class="nav-bar-menu" data-view="educational-degrees">Educational Levels</a></li>
                        <li class="divider"></li>
                        <li class="dropdown-header">TRAINING</li>
                        <li class="<?php echo ($view == 'training-levels'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>#training-levels" class="nav-bar-menu" data-view="training-levels">Training Levels</a></li>
                      </ul>
                    </li>
                  <?php
                }
              }
            ?>
          </ul>

          <?php
            if (!$userIsLogged) {
              ?>
                <form class="navbar-form navbar-right" role="form">
                  <div class="form-group">
                    <input id="login-username-field" type="text" placeholder="Username" class="form-control">
                  </div>
                  <div class="form-group">
                    <input id="login-password-field" type="password" placeholder="Password" class="form-control">
                  </div>
                  <button id="login-signin-button" type="button" class="btn btn-primary" data-loading-text="Signing in...">Sign in</button>
                </form>
              <?php
            }
            else {
              ?>
                <ul class="nav navbar-nav navbar-right">
                  <li><a href="<?php echo base_url(); ?>index.php/profile"><?php echo $user['FullName']; ?></a></li>
                  <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-cog"></span> <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                      <li><a id="logout-link" href="<?php echo base_url(); ?>#logout">Log Out</a></li>
                      <?php
                        if ($user['Role'] == SUPER_USER_ROLE ||
                            $user['Role'] == ADMIN_ROLE) {
                          ?>
                            <li class="divider"></li>
                            <li class="dropdown-header">ADMINISTRATION</li>
                            <li class="<?php echo ($view == 'users-list'? 'active' : 'inactive-menu') ?>"><a href="<?php echo base_url(); ?>index.php/home/users" class="nav-bar-menu" data-view="users-list">System Users</a></li>
                          <?php
                        }
                      ?>
                      <li class="divider"></li>
                      <li class="dropdown-header">INFORMATION</li>
                      <li><a href="<?php echo base_url(); ?>index.php/about">About</a></li>
                      <li><a href="<?php echo base_url(); ?>index.php/contact">Contact</a></li>
                      <li><a href="<?php echo base_url(); ?>index.php/help">Help</a></li>
                    </ul>
                  </li>
                </ul>

                <form class="navbar-form navbar-right">
                  <input type="text" class="form-control search-box" placeholder="Search...">
                </form>
              <?php
            }
          ?>
        </div><!--/.navbar-collapse -->
      </div>
    </div>